//生成token的方法
import fs from "fs"
import path from "path"
import jwt  from "jsonwebtoken"
//获取密钥
const secret = fs.readFileSync(path.join(__dirname,"./screct.txt"),"utf-8")

export default (data, exp = 60 * 60 * 24) =>{
    //过期时间
    let token ="Bearer "+ jwt.sign(data,secret,{
        expiresIn:exp
    })  //数据and密钥
    return token;
}